home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
-
- Global Const Frame_Size = 20
- Global recordcount As Integer
- Global Const FieldCount = 3
- Global Const DBName = "DATA.MDB"
- Global DBPath As String
- Global DBFullPathName As String
- Global DataRecPos As String
- ' DragOver
- Global Const ENTER = 0
- Global Const LEAVE = 1
- Global Const OVER = 2
- 'OLE Client Control
- 'Actions
- Global Const OLE_CREATE_EMBED = 0
- Global Const OLE_CREATE_NEW = 0 'from ole1 control
- Global Const OLE_CREATE_LINK = 1
- Global Const OLE_CREATE_FROM_FILE = 1 'from ole1 control
- Global Const OLE_COPY = 4
- Global Const OLE_PASTE = 5
- Global Const OLE_UPDATE = 6
- Global Const OLE_ACTIVATE = 7
- Global Const OLE_CLOSE = 9
-
-
- Global Const DataPath = "C:\aaamarch\msu\vbmsu\example\"
-
-
-
- Declare Function GetActiveWindow Lib "User" () As Integer
-
- Function chartname (topicstr As String) As String
- Dim mytemp As String
- Dim chpos As Integer
- Dim setpos As Integer
- Dim chnum As Integer
-
- chpos = 1
- Do
- setpos = chpos
- chpos = InStr(chpos + 1, topicstr, "chart", 1)
- Loop While chpos > 0
-
- chnum = Val(Mid(topicstr, setpos + 5, 2))
- chartname = "Chart" & chnum
- End Function
-
- Sub LoadFrame ()
- Dim lstudents As String
- Dim ltest1 As Integer
- Dim ltest2 As Integer
- Dim r As Integer, c As Integer, temp As Integer
- Dim rclear As Integer, cclear As Integer
- Dim Breakout As Integer
- Dim C1Width As Integer, C2Width As Integer
- Dim Calc_Height As Integer
-
-
- Const DELTA = 125
-
- On Error Resume Next
-
- form1.Data1.Recordset.MoveFirst
-
- 'Establish a size for the grid.
- Form2.Grid1.Width = 5000
- Form2.Grid1.Cols = FieldCount + 1
- Form2.Grid1.Rows = Frame_Size
- Form2.Grid1.ColWidth(0) = 200
- Form2.Grid1.ColWidth(1) = 1500
- Form2.Grid1.ColWidth(2) = 1500
- Form2.Grid1.ColWidth(3) = 1500
-
- 'Clear out the current grid contents.
- For rclear = 1 To recordcount
- 'Hit all three columns.
- For cclear = 1 To FieldCount
- Form2.Grid1.Col = cclear
- Form2.Grid1.Text = ""
- Next cclear
- Next rclear
-
- 'Set Column label eg. A B C D...
- Form2.Grid1.Row = 0
- Dim collbl As Integer
- For collbl = 1 To FieldCount
- Form2.Grid1.Col = collbl
- Form2.Grid1.Text = Chr$(64 + collbl)
- Next collbl
-
- 'Set the field names
- Form2.Grid1.Row = 1
- Dim Fcnt As Integer
- For Fcnt = 1 To FieldCount
- Form2.Grid1.Col = Fcnt
- Form2.Grid1.Text = form1.Data1.Recordset.Fields(Fcnt - 1).Name
- Next Fcnt
-
- 'Set Row labels 1
- Form2.Grid1.Row = 1
- Form2.Grid1.Col = 0
- Form2.Grid1.Text = 1
-
- For r = 2 To Frame_Size
-
- Form2.Grid1.Row = r
-
- 'Set Row label eg. 2 3 4 5...
- Form2.Grid1.Col = 0
- Form2.Grid1.Text = r
-
- 'Get employee ID #
- Form2.Grid1.Col = 1
- lstudents = form1.Data1.Recordset!Students
- Form2.Grid1.Text = lstudents
-
- 'Get last name
- Form2.Grid1.Col = 2
- ltest1 = form1.Data1.Recordset!Test1
- Form2.Grid1.Text = ltest1
-
- 'Get first name
- Form2.Grid1.Col = 3
- ltest2 = form1.Data1.Recordset!Test2
- Form2.Grid1.Text = ltest2
-
- 'If it's not the last iteration of this loop, attempt to
- 'move to the next record. If an error occurs, the program
- 'will leave this loop.
- If r <> Frame_Size Then
- form1.Data1.Recordset.MoveNext
- If form1.Data1.Recordset.EOF Then
- Exit For
- End If
- End If
-
- Next r
- recordcount = r
- 'These constants, arrived at experimentally, size the
- 'grid box appropriately.
- Const G_HEIGHT = 60
- Const G_WIDTH = 310
- Form2.Grid1.Rows = recordcount
- Calc_Height = (recordcount) * (Form2.Grid1.RowHeight(1) + G_HEIGHT)
- If Calc_Height > 3000 Then Calc_Height = 3000
- Form2.Grid1.Height = Calc_Height
-
- 'Select all data
- Form2.Grid1.Row = 1
- Form2.Grid1.Col = 1
- Form2.Grid1.SelStartCol = 1
- Form2.Grid1.SelEndCol = FieldCount
- Form2.Grid1.SelStartRow = 1
- Form2.Grid1.SelEndRow = recordcount - 1
- End Sub
-
-